package com.stars.easyms.mq.constant;

import com.stars.easyms.mq.dto.MQInfoDTO;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * MQ常量类
 * 命名规范：WMS_发送模块缩写_接收模块缩写_业务名称
 *
 * @author guoguifang
 * @date 2018-04-23 13:54
 * @since 1.0.0
 */
public final class MQConstants {

    public static final Map<String, MQInfoDTO> MQ_SENDER_INFO_MAP = new ConcurrentHashMap<>(128);

    public static final Map<String, MQInfoDTO> MQ_SENDER_CHANNEL_INFO_MAP = new ConcurrentHashMap<>(128);

    public static final Map<String, MQInfoDTO> MQ_RECEIVER_INFO_MAP = new ConcurrentHashMap<>(128);

    public static final Map<String, MQInfoDTO> MQ_RECEIVER_CHANNEL_INFO_MAP = new ConcurrentHashMap<>(128);

    /**
     * MQ初始化状态：初始化中
     */
    public static final int MQ_INIT_STATUS_ING = 0;

    /**
     * MQ初始化状态：初始化成功
     */
    public static final int MQ_INIT_STATUS_SUCCESS = 1;

    /**
     * MQ初始化状态：初始化失败
     */
    public static final int MQ_INIT_STATUS_FAIL = 2;

    /**
     * MQ默认初始化时间15s
     */
    public static final int MQ_INIT_ING_DELAY_SECONDS = 15;

    /**
     * MQ消息发送/接收状态--1:发送中/处理中,2:发送成功/处理成功,3:发送失败/处理失败并待重新执行,4:发送失败/处理失败不再重新执行
     */
    public static final String MQ_STATUS_PROCESSING = "1";

    /**
     * MQ消息发送/接收状态--1:发送中/处理中,2:发送成功/处理成功,3:发送失败/处理失败并待重新执行,4:发送失败/处理失败不再重新执行
     */
    public static final String MQ_STATUS_SUCCESS = "2";

    /**
     * MQ消息发送/接收状态--1:发送中/处理中,2:发送成功/处理成功,3:发送失败/处理失败并待重新执行,4:发送失败/处理失败不再重新执行
     */
    public static final String MQ_STATUS_FAIL_RETRY = "3";

    /**
     * MQ消息发送/接收状态--1:发送中/处理中,2:发送成功/处理成功,3:发送失败/处理失败并待重新执行,4:发送失败/处理失败不再重新执行
     */
    public static final String MQ_STATUS_FAIL = "4";

    /**
     * 分布式锁
     */
    public static final String MQ_SCHEDULER_LOCK = "mqSchedulerLock";

    /**
     * MQ最大循环调度异常数量
     */
    public static final int MAX_SCHEDULE_EXCEPTION_COUNT = 10000;

    private MQConstants() {}
}
